#ifndef DNDDATATREEMODEL_H
#define DNDDATATREEMODEL_H

#include <QAbstractItemModel>
#include <QStringList>
#include <QList>
#include <QIcon>
#include <QMap>

#include <Xml/XmlPath.h>

class DndDataTreeNode;
class XmlPath;

class DndDataTreeModel : public QAbstractItemModel
{
    Q_OBJECT
public:
    DndDataTreeModel();
    ~DndDataTreeModel();
    QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
    QModelIndex parent(const QModelIndex &index) const;
    bool hasChildren(const QModelIndex &parent = QModelIndex()) const;
    int rowCount(const QModelIndex &parent = QModelIndex()) const;
    int columnCount (const QModelIndex &parent = QModelIndex()) const;
    virtual QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
    static DndDataTreeModel &getInstance();
    void initialize();
public Q_SLOTS:
    void directoryPathUpdated(const QString &);
private:
    void dumpTree(QList<DndDataTreeNode*>, int);
    void setUpDetailTree(DndDataTreeNode *, const XmlPath &);
    void setUpTypeTree(DndDataTreeNode *, XmlPath::BaseTypes);
    QList<DndDataTreeNode *> mTree;
    QMap<QString, DndDataTreeNode *> mMap;
    QMap<QString, QIcon> iconMap;
};

#endif // DNDDATATREEMODEL_H
